<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Auth::routes();

Route::any('sms', 'SmsController@send')->name('sms');

Route::get('oauth/callback/driver/{driver}', 'OauthController@handleProviderCallback')->name('oauth.callback');
Route::get('oauth/redirect/driver/{driver}', 'OauthController@redirectToProvider')->name('oauth.login');



// 设备扫码开启
Route::get('scan/index', 'ScanController@index')->name('scan.index');
Route::get('scan/scan', 'ScanController@scan')->name('scan.scan');


Route::get('about', 'PageController@index')->name('about.index');

Route::get('/', function () {
    return view('welcome');
});

Route::group(['middleware' => 'auth'], function () {
    /**
     *  用户中心
     */
    Route::get('/home', 'UserController@index')->name('user.index');
    Route::get('order', 'OrderController@index')->name('user.order');
    Route::get('member', 'UserController@list')->name('user.member');
    Route::get('record', 'RecordController@index')->name('user.record');


    Route::get('user/create', 'UserController@create')->name('user.create');
    Route::post('user/create', 'UserController@store')->name('user.store');
    Route::delete('user/delete', 'UserController@destroy')->name('user.delete');
    /**
     *  设备中心
     */
    //未绑定，绑定界面
    Route::get('unbound', 'ScanController@unbound')->name('scan.unbound');
    //已经绑定的用户格子显示界面
    Route::get('bound', 'ScanController@bound')->name('scan.bound');


    Route::get('device', 'DeviceController@index')->name('user.device');
    // 设备维修
    Route::get('repair/{id?}', 'DeviceController@repairForm')->name('device.repair');
    //提交维修记录
    Route::post('repair/{id?}', 'DeviceController@repair')->name('device.repairForm');

    // 设备续费
    Route::get('renewal/{id?}', 'WalletController@showPackageForm')->name('device.renewal');
    Route::post('renewal/{id}', 'WalletController@renewal');


    //vendor全部设备
    Route::get('vendor/devices', 'DeviceController@allEquipment')->name('vendor.device');
    //vendor待维修设备
    Route::get('vendor/device/repair', 'DeviceController@waitingForRepair')->name('vendor.wait');
    //vendor维修记录
    Route::get('vendor/device/repair-records', 'DeviceController@repairRecords')->name('vendor.repairRecords');
    //vendor收益记录
    Route::get('vendor/income/records', 'WalletController@records')->name('vendor.incomeRecords');
    /**
     * 选择柜门（以及绑定）
     */


    /**
     *  订单中心
     */

    //提现
    Route::any('wallet', 'WalletController@withdraw')->name('vendor.wallet');
    Route::any('withdrawAudit', 'WalletController@withdrawAudit')->name('vendor.withdrawAudit');
    //支付押金
    Route::get('deposit', 'WalletController@deposit')->name('user.deposit');

    // 退押金申请
    Route::get('refund/{id?}', 'WalletController@showRefundPage')->name('deposit.refund');
    Route::post('refund/{id?}', 'WalletController@refund');

    Route::get('cancelRefund/{id}', 'WalletController@cancelRefund')->name('refund.cancel');

    //时租用户的订单详情
    Route::get('orderDetail', 'UserController@orderDetail')->name('user.orderDetail');
    //公司租赁保修中利用设备号查询设备格子
    Route::any('chestGrip', 'DeviceController@chestGrip')->name('user.chestGrip');

    //下订单
    Route::any('order/generate', 'OrderController@generateOrder')->name('order.generate');
    //支付中心
    Route::get('counter', 'CounterController@wechat')->name('counter.wechat');
});
























